package com.cc.Services;

import com.cc.entity.Comment;
import com.cc.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CommentServicesImpl implements ICommentService{
    @Autowired
    private CommentMapper commentMapper;

    @Override
    public List<Comment> listByPage(Integer page, Integer pageSize) {
        Integer from=(page-1)*pageSize;
        return commentMapper.findByPage(from,pageSize);

    }


    public int deleteByid(Integer id) {
        return commentMapper.delete(id);
    }
    public Comment selectByCondition(Integer id) {
        return  commentMapper.selectByCondition(id);
    }


    public int updateById(Comment comment) {
        return commentMapper.updateByPrimaryKey(comment);
    }

    @Override
    public int total() {
        return commentMapper.total();
    }
}
